package com.kai.common.utils;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;

/**
 * <p>Project: furina-tea-party </p>
 * <p>Description: </p>
 * <p>Copyright (c) 2024 Karrytech (Shanghai/Beijing) Co., Ltd.</p>
 * <p>All Rights Reserved.</p>
 *
 * @author <a href="mailto:zhangkai@karrytech.com">Zhang Kai</a>
 */
public class FileUtil {
    public static void save(String path, byte[] buf) throws IOException {
        FileChannel channel = FileChannel.open(Paths.get(path), StandardOpenOption.WRITE, StandardOpenOption.READ, StandardOpenOption.CREATE);
        channel.write(ByteBuffer.wrap(buf));
        channel.close();
    }
}